home *** CD-ROM | disk | FTP | other *** search
- Path: gwen.pcug.co.uk!altheim!broldham
- Newsgroups: comp.lang.c
- Message-ID: <1168@altheim.win-uk.net>
- References: <1996Feb21.101532.15110@es.dupont.com> <1996Feb21.174407.20730@newshost.micro.ti.com><4ghq1u$sed@hpbblb.bbn.hp.com>
- Reply-To: broldham@altheim.win-uk.net (Brian R. Oldham)
- From: broldham@altheim.win-uk.net (Brian R. Oldham)
- Date: Mon, 26 Feb 1996 12:32:47 GMT
- Subject: Re: String Encryption
-
-
- In article <4ghq1u$sed@hpbblb.bbn.hp.com>, Matthias Dittrich (matti) writes:
- >brett@racerx.micro.ti.com (Brett L. Huber) wrote:
- >>Malcolm Smart (MALCOLM.SMART@CONOCO.DUPONT.COM) wrote:
- >>> Has anybody out there got any small routines that I can apply to strings
- >>> which will effectively encrypt them (and decrypt!). It's not a matter of
- >>> state security so it doesn't have to be that secure, just make it
- >>> unreadable.
- >>
- >>It really depends on what level of "unreadability" you want. Who are
- >>you protecting the data from? If you aren't protecting a secret, try
- >>"rot13," which translates A->N, B->O, ... Z->M.
- >>
- >>For an introduction to cryptographic techniques, try the sci.crypt FAQ:
- >>http://www.cis.ohio-state.edu/hypertext/faq/bngusenet/sci/crypt/top.html
- >>
- >> ...
- >You also can use the crypt() function (see man 3 crypt).
- >
- >Good luck,
- >Matthias
- >
- Thanks for this information. But for those who like me have only
- mail & news (no web access) it is helpful to find information here.
-
- To comply with Malcolm's caveat, that the encryption routine should
- be a simple one I have found this effective:
-
- for(i=0; i<strlen(buffer); i++)
- str[i] = ~buffer[i]; /* note the ~ operator */
-
- The ~ operator flips all bits in each byte read rendering the text in
- str unreadable. Use the same operation to reverse it.
-
-
- ---
- Brian Oldham
- Hucknall UK
- !...Gesundbrunnen
-
-
-
-
-
-
-
-
-